package com.jiajiabao.ucar;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;
import com.fan.txl.R;
import com.fan.txl.ui.base.BaseActivity;
import com.tencent.mm.sdk.modelbase.BaseReq;
import com.tencent.mm.sdk.modelbase.BaseResp;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;



public class WXPayEntryActivity extends BaseActivity implements IWXAPIEventHandler {


	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_design);
		getWxApi().handleIntent(getIntent(), this);
	}

	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		setIntent(intent);
		getWxApi().handleIntent(intent, this);
	}

	@Override
	public void onReq(BaseReq req) {
		Toast.makeText(this, "onReq!", Toast.LENGTH_SHORT).show();
	}

	@Override
	public void onResp(BaseResp resp) {
		int code = resp.errCode;
		switch (code){
			case BaseResp.ErrCode.ERR_OK://支付成功后的界面
				Toast.makeText(this, "支付成功!", Toast.LENGTH_SHORT).show();
				break;
			case BaseResp.ErrCode.ERR_COMM:
				Toast.makeText(this, "支付异常，无法完成支付!", Toast.LENGTH_SHORT).show();
				break;
			case BaseResp.ErrCode.ERR_USER_CANCEL://用户取消支付后的界面
				break;

		}
		//finish();

	}
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if (keyCode == KeyEvent.KEYCODE_BACK) {
		}
		return false;
	}
}
